package com.wc.AlgoOJ_train.train3_算法大礼包.c2_深度优先搜索.AG0303_棋盘问题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/28 16:30
 * @description
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 15;
    static char[][] grid = new char[N][];
    static int n, k;
    // 列是否
    static boolean[] vis = new boolean[N];
    static int res;

    public static void main(String[] args) {
        while (sc.hasNext()) {
            n = sc.nextInt();
            k = sc.nextInt();
            if (n == -1 && k == -1)
                break;
            for (int i = 1; i <= n; i++) {
                grid[i] = (" " + sc.next()).toCharArray();
            }
            res = 0;
            dfs(1, 0);
            out.println(res);
        }
        out.flush();
    }

    static void dfs(int floor, int num) {
        if (floor == n + 1 || num == k) {
            if (num == k) res++;
            return;
        }
        for (int i = 1; i <= n; i++) {
            if (grid[floor][i] == '#' && !vis[i]) {
                vis[i] = true;
                dfs(floor + 1, num + 1);
                vis[i] = false;
            }
        }
        // 这个排什么都不放
        dfs(floor + 1, num);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
